package com.kefu.exam.vo;

import org.apache.commons.lang3.StringUtils;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.kefu.common.context.KefuContext;
import com.kefu.common.vo.AbstractSearchVo;
import com.kefu.exam.model.ExamPaper;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

/**
 * @author xy
 * @date 2022/02/28
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@ApiModel(description = "考卷表")
public class ExamPaperSearchVo extends AbstractSearchVo {
    @ApiModelProperty(value = "试卷名")
    private String paperName;
	@ApiModelProperty(value = "调查问卷id")
	private String paperId;
    @ApiModelProperty(value = "更新时间开始")
    private Long updateTimeStart;
    @ApiModelProperty(value = "更新时间结束")
    private Long updateTimeEnd;


	 @Override
    public  LambdaQueryWrapper<ExamPaper> lambdaQuery(){

    	LambdaQueryWrapper<ExamPaper> wrapper=Wrappers.<ExamPaper>lambdaQuery();
		 wrapper.eq(StringUtils.isNotBlank(paperId), ExamPaper::getPaperId, paperId);
	    wrapper.like(StringUtils.isNotBlank(paperName), ExamPaper::getPaperName, paperName);//试卷名wrapper.eq(StringUtils.isNotBlank(paperId),ExamPaper::getPaperId,paperId);
		wrapper.ge(updateTimeStart!=null, ExamPaper::getUpdateTime, updateTimeStart);//更新时间开始
		wrapper.le(updateTimeEnd!=null, ExamPaper::getUpdateTime, updateTimeEnd);//更新时间结束
	    wrapper.eq(ExamPaper::getTenantId, KefuContext.getKefuContext().getTenantId());
    	return wrapper;
	}

}